import React, {Component} from 'react';
import BodyItem from "./bodyItem.jsx";
import PropTypes from 'prop-types'
import './body.scss'

//todoList中间列表
class Body extends Component {
    static propTypes = {
        data: PropTypes.array.isRequired,
        editStatus: PropTypes.func.isRequired,
        delItem: PropTypes.func.isRequired,

    }

    // //修改状态
    // editStatus = (id,status) => {
    //     this.props.editStatus([id],status)
    // }
    // delItem = (id)=>{
    //     this.props.delItem([id])
    // }

    render() {
        return (
            <div className={'body-body'}>
                {this.props.data.map((item) => <BodyItem delItem={this.props.delItem} editStatus={this.props.editStatus} info={item} key={item.id}/>)}
                {
                    this.props.data.length === 0 ? <div className={'body-body-empty'}>暂无待办事项</div> : ''
                }
            </div>
        );
    }
}

export default Body;